import { getLevelFirst, getLevelZero, getUserID } from '@/utils';

export const ManageTabSwitch = (curRes: Record<string, any>) => {
  if (curRes?.['/assetStoreRecord/applyCompanyID']) {
    // 单位权限
    return {
      params: 'applyCompanyID',
      applyCompanyID: getLevelZero(),
    };
  } else if (curRes?.['/assetStoreRecord/applyDepartmentID']) {
    return {
      params: 'applyDepartmentID',
      applyDepartmentID: getLevelFirst(),
    };
  } else if (curRes?.['/assetStoreRecord/applyerID']) {
    return {
      params: 'applyerID',
      applyerID: getUserID(),
    };
  }
};

// 出入库记录数据范围
export const RecordManageTab = (curRes: Record<string, any>) => {
  if (curRes?.['/assetStoreRecord/dataGrid/createCompanyID']) {
    return {
      createCompanyID: getLevelZero(),
      params: 'createCompanyID',
    };
  } else if (curRes?.['/assetStoreRecord/dataGrid/createDepartmentID']) {
    return {
      createDepartmentID: getLevelFirst(),
      params: 'createDepartmentID',
    };
  } else {
    return {};
  }
};
